﻿package com.mui.controls
{
    import flash.events.*;
    import flash.net.*;
    import flash.ui.*;

    public class GLinkButton extends GTextFiled
    {
        private var _url:String = "";
        private var _overHtml:String = "";
        private var _outHtml:String = "";
        private var _useHand:Boolean = true;

        public function GLinkButton()
        {
            return;
        }// end function

        public function get UseHand() : Boolean
        {
            return this._useHand;
        }// end function

        public function set UseHand(param1:Boolean) : void
        {
            this._useHand = param1;
            return;
        }// end function

        public function get Url() : String
        {
            return this._url;
        }// end function

        public function set Url(param1:String) : void
        {
            this._url = param1;
            if (this._url != "")
            {
                this.configEventListener(MouseEvent.CLICK, this.onMouseLinkClick);
            }
            else
            {
                this.removeEventListener(MouseEvent.CLICK, this.onMouseLinkClick);
            }
            return;
        }// end function

        public function get OverHtml() : String
        {
            return this._overHtml;
        }// end function

        public function set OverHtml(param1:String) : void
        {
            this._overHtml = param1;
            if (this._overHtml != "")
            {
                this.configEventListener(MouseEvent.MOUSE_OVER, this.onMouseLinkOver);
            }
            else
            {
                this.removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseLinkOver);
            }
            return;
        }// end function

        public function get OutHtml() : String
        {
            return this._outHtml;
        }// end function

        public function set OutHtml(param1:String) : void
        {
            this._outHtml = param1;
            if (this._outHtml != "")
            {
                this.configEventListener(MouseEvent.MOUSE_OUT, this.onMouseLinkOut);
            }
            else
            {
                this.removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseLinkOut);
            }
            return;
        }// end function

        private function onMouseLinkClick(event:MouseEvent) : void
        {
            var _loc_2:URLRequest = null;
            if (this.Url != "")
            {
                _loc_2 = new URLRequest(this.Url);
                navigateToURL(_loc_2, "_blank");
            }
            return;
        }// end function

        private function onMouseLinkOver(event:MouseEvent) : void
        {
            this.htmlText = this.OverHtml;
            if (this.UseHand)
            {
                Mouse.cursor = MouseCursor.BUTTON;
            }
            return;
        }// end function

        private function onMouseLinkOut(event:MouseEvent) : void
        {
            this.htmlText = this.OutHtml;
            if (this.UseHand)
            {
                Mouse.cursor = MouseCursor.ARROW;
            }
            return;
        }// end function

    }
}
